package com.wangdong.mijiqiqi;

import android.app.Application;
import android.content.ComponentCallbacks;
import android.content.Context;
import android.content.res.Configuration;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager;


public class MyApp extends Application {


    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        //因为引用的包过多，实现多包问题
//        MultiDex.install(this);
    }
    public static final String TAG = MyApp.class.getSimpleName();

    public MyApp() {
        super();
    }
    /**程序创建的时候执行*/
    @Override
    public void onCreate() {
        Log.i(TAG, "onCreate");
        super.onCreate();
        /** 初始化客户端信息,通过下列方法，我们会创建一个ClientInfo对象，并为该对象的字段赋值 */
        ConfigManager.getInstance().initClientInfo(this);
        // 初始化屏幕信息
        WindowManager manager = (WindowManager) getApplicationContext().getSystemService(
                Context.WINDOW_SERVICE);
        DisplayMetrics dm = new DisplayMetrics();
        manager.getDefaultDisplay().getMetrics(dm);
        ScreenArgument.SCREEN_WIDTH = dm.widthPixels;
        ScreenArgument.SCREEN_HEIGHT = dm.heightPixels;
        ScreenArgument.DENSITY = dm.density;
        ScreenArgument.S_DENSITY = dm.scaledDensity;
    }
    /**程序终止的时候执行*/
    @Override
    public void onTerminate() {//翻译：Terminate终止
        Log.i(TAG, "onTerminate");
        super.onTerminate();
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {//翻译：ConfigurationChanged配置改变
        Log.i(TAG, "onConfigurationChanged配置改变");
        super.onConfigurationChanged(newConfig);
    }

    @Override
    public void onLowMemory() {//翻译：LowMemory低内存
        Log.i(TAG, "LowMemory低内存");
        super.onLowMemory();
    }
    /** 程序在内存清理的时候执行*/
    @Override
    public void onTrimMemory(int level) {//翻译：TrimMemory 三存储   回收内存
        Log.i(TAG, "TrimMemory 三存储");
        super.onTrimMemory(level);
    }

    @Override
    public void registerComponentCallbacks(ComponentCallbacks callback) {//翻译：registerComponentCallbacks注册组件回调
        Log.i(TAG, "registerComponentCallbacks注册组件回调");
        super.registerComponentCallbacks(callback);
    }

    @Override
    public void unregisterComponentCallbacks(ComponentCallbacks callback) {//翻译：unregisterComponentCallbacks取消注册组件回调
        Log.i(TAG, "unregisterComponentCallbacks取消注册组件回调");
        super.unregisterComponentCallbacks(callback);
    }

    @Override
    public void registerActivityLifecycleCallbacks(ActivityLifecycleCallbacks callback) {//翻译：registerActivityLifecycleCallbacks注册Activity生命周期
        Log.i(TAG, "registerActivityLifecycleCallbacks注册Activity生命周期");
        super.registerActivityLifecycleCallbacks(callback);
    }

    @Override
    public void unregisterActivityLifecycleCallbacks(ActivityLifecycleCallbacks callback) {//翻译：unregisterActivityLifecycleCallbacks取消注册Activity生命周期
        Log.i(TAG, "unregisterActivityLifecycleCallbacks取消注册Activity生命周期");
        super.unregisterActivityLifecycleCallbacks(callback);
    }

    @Override
    public void registerOnProvideAssistDataListener(OnProvideAssistDataListener callback) {//翻译：registerOnProvideAssistDataListener寄存器提供辅助数据寄存器
        Log.i(TAG, "registerOnProvideAssistDataListener寄存器提供辅助数据寄存器");
        super.registerOnProvideAssistDataListener(callback);
    }

    @Override
    public void unregisterOnProvideAssistDataListener(OnProvideAssistDataListener callback) {//翻译： unregisterOnProvideAssistDataListener取消注册提供辅助数据
        Log.i(TAG, "unregisterOnProvideAssistDataListener取消注册提供辅助数据");
        super.unregisterOnProvideAssistDataListener(callback);
    }
}
